package com.woniuxy.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.woniuxy.entity.MenuTable;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author zcx, ftl, gr, rhs
 * @since 2021-12-31
 */
public interface MenuTableMapper extends BaseMapper<MenuTable> {

    @Select("SELECT DISTINCT t4.* FROM `user_table` t1 JOIN  user_role t2 ON t1.user_id=t2.user_id\n" +
            "JOIN role_menu t3 ON t2.role_id=t3.role_id \n" +
            "JOIN menu_table t4 ON t3.menu_id=t4.menu_id  ${ew.customSqlSegment} ")
    List<MenuTable> listMenusByKey(@Param(Constants.WRAPPER) QueryWrapper<MenuTable> queryWrapper);
}
